package com.atguigu.principle.singleresponsibility.inversion.improve;



/**
 * @Author: yangtao
 * @Description:
 */
public class DependencyPass {

    public static void main(String[] args) {
        ChangHong changHong = new ChangHong();
        OpenAndClose openAndClose = new OpenAndClose();
        openAndClose.open(new ChangHong());

    }
}


//开关的接口
interface  IOpenAndClose{
    //抽象方法 接收接口
    public void open(ITV itv);
}

 interface ITV{
    public  void play();
 }

 class ChangHong implements ITV{

     @Override
     public void play() {
         System.out.println("打开长虹电视机");
     }
 }

 class  OpenAndClose implements IOpenAndClose{
     @Override
     public void open(ITV itv) {
         itv.play();
     }
 }